/*
 * rstml_exception.cpp
 *
 *  Created on: 16.01.2011
 *      Author: Dmitry Bratus
 */

#include "rstml_exception.hpp"

#include <stml_exception.hpp>

using namespace stml;

VALUE g_eStmlException;

VALUE get_rstml_exception_class() {
    return g_eStmlException;
}

void set_rstml_exception_class(VALUE klass) {
    g_eStmlException = klass;
}

VALUE rstml_exception_initialize(VALUE self, VALUE message, VALUE error_code, VALUE line_no) {
    VALUE super_args[] = { message };
    rb_call_super(1, super_args);

    rb_iv_set(self, "@error_code", error_code);
    rb_iv_set(self, "@line_no", line_no);

    return self;
}

VALUE rstml_exception_error_code(VALUE self) {
    return rb_iv_get(self, "@error_code");
}

VALUE rstml_exception_line_no(VALUE self) {
    return rb_iv_get(self, "@line_no");
}
